/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.notice.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.modules.notice.enums.TriggerConditionEnum;
import org.springblade.modules.notice.enums.TriggerNodeEnum;

/**
 * 业务消息管理表实体类
 *
 * @author ysq
 * @since 2024-11-20
 */
@Data
@TableName("blade_biz_msg_config")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BizMsgConfig对象", description = "业务消息管理表")
public class BizMsgConfig extends TenantEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 消息名称
	 */
	@ApiModelProperty(value = "消息名称")
	private String name;
	/**
	 * 所属业务
	 */
	@ApiModelProperty(value = "所属业务")
	private Integer businessType;
	/**
	 * 触发节点
	 */
	@ApiModelProperty(value = "触发节点")
	private Integer node;
	/**
	 * 触发条件
	 */
	@ApiModelProperty(value = "触发条件")
	private Integer triggerCondition;
	/**
	 * 推送时间，0-立即推送，大于0延迟推送（单位/分钟）
	 */
	@ApiModelProperty(value = "推送时间，0-立即推送，1-延迟推送")
	private Integer pushTime;

	@ApiModelProperty(value = "延迟时间（单位/分钟），多个逗号隔开")
	private String delayMinute;

	@ApiModelProperty(value = "0-普通消息，1-特殊消息")
	private Integer common;
	/**
	 * 系统默认-0，租户-1
	 */
	@ApiModelProperty(value = "系统默认-0，租户-1")
	private Integer systemDefault;

	@TableField(exist = false)
	@ApiModelProperty(value = "触发节点描述")
	private String nodeDesc;

	@TableField(exist = false)
	@ApiModelProperty(value = "触发条件描述")
	private String triggerConditionDesc;

	public String getNodeDesc() {
		return TriggerNodeEnum.getDesc(node);
	}

	public String getTriggerConditionDesc() {
		return TriggerConditionEnum.getDesc(triggerCondition);
	}
}
